import Mock from "mockjs";
const gongzi = Mock.mock({
  "data|20": [
    {
     "name":"@cname",
      "sex|1":["男","女"],
      "phone|1":"@phone",
      "goodsId|+1": 1,
      goodsAddress: "@county(true)",
      "zhiwei|1":["销售经理","员工","主管","人事"],
      "zaizhi|1":["在职","离职"],
      "mtime":"@date(2021/mm/dd)",
      "yinghan|1":["中国工商银行","邮政存蓄银行","中国建设银行"],
       "gongz|1":["是","否"],

    },
  ],
});
class Mockapi {
    //数据渲染
  getgongzi() {
    return Promise.resolve({
      status: 0,
      result: gongzi,
    });
  }
  //查找功能
  getchazhao(obj:any){
    const newgongzi = gongzi.data.filter((item:any)=>{
        if(item.goodsId==obj.id||item.name==obj.names||item.phone==obj.phone||item.zhiwei==obj.zhiwei){
            return item
        }
      })
      console.log(newgongzi);
      return Promise.resolve({
            status: 0,
            result: newgongzi,
          });
  }
}
export const mockapi = new Mockapi();